package com.example.administrator.newjiajiesong.view.dialog;

import android.app.Activity;
import android.content.Context;
import android.view.View;

import com.example.administrator.newjiajiesong.R;


/**
 * Created by: xudiwei
 * <p>
 * on: 2017/5/16.
 * <p>
 * 描述：加载中禁止用户手机关闭的对话框
 */

public class LoadingDialog extends BaseDialog {
    private boolean mClose = true;

    public LoadingDialog(Context context) {
        super(context, View.inflate(context, R.layout.dialog_loading, null), R.style.avatar_dialog_style);
        setCanceledOnTouchOutside(false);
    }


    @Override
    public void onClick(View v) {
//        super.onClick(v);
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        if (mClose) {
            ((Activity) mContext).finish();
        }
    }

    /**
     * 当用户按下返回键时是否关闭Activity
     * @param close
     */
    public void setPressBackCloseActivity(boolean close) {
        this.mClose = close;
    }
}
